package com.cn.wanxi.util;

import java.io.*;

public class TestFile {
    public static void main(String[] args) {
        File file =new File("C:\\Users\\Administrator\\Desktop\\2020.01.02-Java基础案例（带图）\\餐饮美食\\图片1\\21.png");
        try {
            InputStream inputStream=new FileInputStream(file);
            int read=0;
            String path="d:\\aa.gggggggg";
            File newFile=new File(path);
            newFile.createNewFile();
            OutputStream outputStream=new FileOutputStream(newFile);
//            outputStream.write(111);
            while ((read=inputStream.read())!=-1){

//                System.out.println((char)read);
                outputStream.write(read);
            }

            outputStream.flush();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
